﻿<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="EditQuizQuestAns.aspx.vb" Inherits="Training.EditQuizQuestAns" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Training - Training:: Edit Quiz Question Answers</title>
<link rel="Stylesheet" type="text/css" media="screen" href="../css/adminStyle.css" />
</head>
<body>
    <form id="form1" runat="server">
    <div class="ctr">
        <h2>Edit Answers For Quiz Question</h2>
        
        <h3>Quiz: 
            <asp:Label ID="lblQuiz" runat="server" Text=""></asp:Label> - 
            Question: 
            <asp:Label ID="lblQuest" runat="server" Text=""></asp:Label></h3>
            
        <p>Choose to delete an answer or add a new one.</p>
            
        <div style="width:500px;text-align:left;margin:0 auto;" class="text">
            <b>Current Answers</b><br />
            <asp:GridView ID="gvAnswers" runat="server" AutoGenerateColumns="False" 
                DataSourceID="dsQuestionAnswers" EmptyDataText="No Answers Assigned" 
                Width="100%">
                <RowStyle CssClass="row1" />
                <EmptyDataRowStyle CssClass="row1" />
                <Columns>
                    <asp:BoundField DataField="AnswerID" HeaderText="ID" SortExpression="AnswerID">
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:BoundField DataField="AnswerOrder" HeaderText="Order" 
                        SortExpression="AnswerOrder">
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:CheckBoxField DataField="CorrectAnswer" HeaderText="Correct Answer" 
                        SortExpression="CorrectAnswer">
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Center" />
                    </asp:CheckBoxField>
                    <asp:BoundField DataField="Answer" HeaderText="Answer" SortExpression="Answer">
                    <HeaderStyle HorizontalAlign="Left" />
                    <ItemStyle HorizontalAlign="Left" />
                    </asp:BoundField>
                    <asp:TemplateField HeaderText="Delete">
                        <ItemTemplate>
                            <%#DeleteLink(Eval("AnswerID"))%>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center" />
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                </Columns>
                <HeaderStyle CssClass="rowHead" />
                <AlternatingRowStyle CssClass="row2" />
            </asp:GridView>
            
            <br />
            
            <b>Add New Answer</b><br />
            <div class="row">
                <div class="full">
                    Select Answer: 
                    <asp:RangeValidator ID="rvAnswer" runat="server" ErrorMessage="required" 
                        ControlToValidate="ddlAnswer" CssClass="small" Display="Dynamic" 
                        MaximumValue="90000" MinimumValue="1" Type="Integer"></asp:RangeValidator><br />
                    <asp:DropDownList ID="ddlAnswer" CssClass="formfield" runat="server" 
                        AppendDataBoundItems="True" AutoPostBack="True" DataSourceID="dsAnswers" 
                        DataTextField="Answer" DataValueField="AnswerID">
                        <asp:ListItem Value="-1" Text="-select-"></asp:ListItem>
                    </asp:DropDownList>
                </div>
                <div class="clr"></div>
            </div>
            
            <div class="row">
                <div class="full">
                    Answer Order: 
                    <asp:RequiredFieldValidator ID="rfOrder" runat="server" ErrorMessage="required" 
                        ControlToValidate="tbOrder" CssClass="small" Display="Dynamic"></asp:RequiredFieldValidator><br />
                    <asp:TextBox ID="tbOrder" CssClass="formfield" Width="25" runat="server"></asp:TextBox>
                </div>
                <div class="clr"></div>
            </div>
            
            <div class="row">
                <div class="full">
                    Correct Answer: 
                    <asp:RangeValidator ID="rvCorrect" runat="server" ErrorMessage="required" 
                        ControlToValidate="ddlCorrect" CssClass="small" Display="Dynamic" 
                        MaximumValue="1" MinimumValue="0" Type="Integer"></asp:RangeValidator><br />
                    <asp:DropDownList ID="ddlCorrect" CssClass="formfield" runat="server">
                        <asp:ListItem Value="-1" Text="--"></asp:ListItem>
                        <asp:ListItem Value="1" Text="yes"></asp:ListItem>
                        <asp:ListItem Value="0" Text="no"></asp:ListItem>
                    </asp:DropDownList>
                </div>
                <div class="clr"></div>
            </div>
            
            <div class="row">
                <div class="full">
                    <asp:Button ID="btnContinue" runat="server" Text="continue" CssClass="button" />
                    &nbsp;
                    <asp:Button ID="btnComplete" runat="server" Text="complete" 
                        CssClass="button" CausesValidation="false" />
                </div>
                <div class="clr"></div>
            </div>
        </div>
        
        <asp:Label ID="lblMsg" runat="server" Text=""></asp:Label>
        
        <p><b><a href="QuizControl.aspx">Quiz Control</a></b></p>
        <br />
        <p><a href="Default.aspx">Admin Main</a></p>
    </div>
    
    <asp:SqlDataSource ID="dsQuestionAnswers" runat="server" 
        ConnectionString="<%$ ConnectionStrings:Conn %>" 
        SelectCommand="proc_AdminGetQuizQuestionAnswers" 
        SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:SessionParameter Name="QuizID" SessionField="qid" Type="Int32" />
            <asp:SessionParameter Name="QuestionID" SessionField="qsid" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    
    <asp:SqlDataSource ID="dsAnswers" runat="server" 
        ConnectionString="<%$ ConnectionStrings:Conn %>" 
        SelectCommand="SELECT [AnswerID], [Answer] FROM [QuizAnswers]"></asp:SqlDataSource>
    
    </form>
</body>
</html>
